FROM microsoft/dotnet:2.1-runtime AS base
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime    
RUN echo "Asia/Shanghai" > /etc/timezone    
RUN dpkg-reconfigure -f noninteractive tzdata
WORKDIR /app

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Host/Host.csproj Host/
COPY Infrastructure.Repository/Infrastructure.Repository.csproj Infrastructure.Repository/
COPY Domain/Domain.csproj Domain/
COPY Infrastructure.Common/Infrastructure.Common.csproj Infrastructure.Common/
COPY Application/Application.csproj Application/
RUN dotnet restore Host/Host.csproj  -s http://dev.rhpass.com:7000/nuget -s https://api.nuget.org/v3/index.json
COPY . .
WORKDIR /src/Host
RUN dotnet build Host.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish Host.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Host.dll"]
